package com.qf.program.controller;


import com.qf.common.beans.ResultBean;
import com.qf.common.utils.CheckUtil;
import com.qf.program.service.CreatePmidList;
import com.qf.program.service.合并到本地256G;
import lombok.extern.slf4j.Slf4j;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@Slf4j
@RestController
@RequestMapping("utils")
public class UtilController {


    @Resource
    CreatePmidList createPmidList;


    @GetMapping("updatexml")
    public ResultBean<Object> updateXmlTodo(Integer start, Integer end) {
        if (start == null || end == null) {
            CheckUtil.check(false, "参数错误");
        }
        if (start > end) {
            CheckUtil.check(false, "参数错误");
        }
        if (start.toString().length()<5||end.toString().length()<5) {
            CheckUtil.check(false, "参数错误");
        }
        log.info("更新xml 开始 start={} end={}",start,end);
        createPmidList.updatePmidList(start,end);
        return new ResultBean<>("");

    }

    @GetMapping("merge256")
    public ResultBean<Object> merge256() {
        String[] args = new String[]{""};
        合并到本地256G.main(args);
        return new ResultBean<>("");

    }






}
